﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace nyxwin.Data.Bookmarks
{
	public class BookmarksTypeConversion
	{
		#region ToString
		public static string ToString(BookmarksTypeEnum bookmarksType)
		{
			switch (bookmarksType)
			{
				case BookmarksTypeEnum.All:
					return "all";

				case BookmarksTypeEnum.MovementHistory:
					return "history";

				case BookmarksTypeEnum.New:
					return "new";
			}

			throw new NyxException("unknown bookmarksType");
		} 
		#endregion

		#region FromString
		public static BookmarksTypeEnum FromString(string strBookmarksType)
		{
			if (string.IsNullOrEmpty(strBookmarksType))
				throw new NyxException("strBookmarksType can not be null nor empty !");

			switch (strBookmarksType.ToLower())
			{
				case "all":
					return BookmarksTypeEnum.All;

				case "history":
					return BookmarksTypeEnum.MovementHistory;

				case "new":
					return BookmarksTypeEnum.New;
			}

			throw new NyxException(string.Format("unknown bookmarks type {0}", strBookmarksType));
		}
		#endregion
	}
}
